<!--
 * @Author: ૮₍ ˙О˙₎ა
 * @Date: 2023-07-18 18:31:00
-->
<template>
  <div>
    <el-button type="primary" :icon="Plus">添加SPU</el-button>

    <el-table style="width: 100%" border stripe>
      <el-table-column prop="序号" label="序号" width="180" />
      <el-table-column prop="SPU名称" label="SPU名称" width="180" />
      <el-table-column prop="address" label="SPU描述" />
      <el-table-column prop="address" label="操作" />
    </el-table>

    <el-pagination
      :current-page="page"
      :page-size="limit"
      :page-sizes="[5, 10, 15, 20]"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script lang="ts" setup>
import { Plus } from '@element-plus/icons-vue'
import { ref } from 'vue'

const page = ref(1)
const limit = ref(5)
const total = ref(0)

const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
</script>

<script lang="ts">
export default {
  name: 'SpuList'
}
</script>

<style lang="scss" scoped>
.el-table {
  margin-top: 10px;
}
.el-pagination {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}
</style>
